package cn.ihelloworld.bean;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name="catagory")
@GenericGenerator(name="idGenerator", strategy="uuid")
public class Catagory implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3447638272293647181L;
	private String id;
	private String code;
	private String name;
	private Integer turn;
	private String intro;
	
	private List<Article> articlesLast;
	private List<Article> articlesHot;
	
	public Catagory(){
		
	}
	public Catagory(String code,String name,Integer turn,String intro){
		this.code=code;
		this.name=name;
		this.turn=turn;
		this.intro=intro;
	}
	public String getCode() {
		return code;
	}
	@Id
	@GeneratedValue(generator="idGenerator")
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Integer getTurn() {
		return turn;
	}
	public void setTurn(Integer turn) {
		this.turn = turn;
	}
	public String getIntro() {
		return intro;
	}
	public void setIntro(String intro) {
		this.intro = intro;
	}
	@Transient 
//	@OneToMany(fetch=FetchType.LAZY)
//	@JoinColumn(name="catagory_id")
	public List<Article> getArticlesLast() {
		return articlesLast;
	}
	public void setArticlesLast(List<Article> articlesLast) {
		this.articlesLast = articlesLast;
	}
	@Transient 
//	@OneToMany(fetch=FetchType.LAZY)
//	@JoinColumn(name="catagory_id")
	public List<Article> getArticlesHot() {
		return articlesHot;
	}
	public void setArticlesHot(List<Article> articlesHot) {
		this.articlesHot = articlesHot;
	}
}
